<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <script src="vue.js"></script>
    <script src="my-vuex.js"></script>
    <script>
      //第一个模块
      let counter1 = {
        state:()=>({count:1})
      }
      //第2个模块
      let counter2 = {
        state:()=>({count:2})
      }
      const store = new Vuex.Store({
        state:{count:0},
        modules:{
          counter1,
          counter2
        }
      });
      console.log(store.state)
      console.log(store.state.counter1.count)
      console.log(store.state.counter2.count)
    </script>
  </body>
</html>
